import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
   {
    path: '/',
    name: 'login',
    component:()=>import('../views/Login.vue')

  },
  

  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: function () {
      return import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
    }
  },
  // 注册
  {
    path: '/register',
    name:'register',
    component: ()=>import('../views/register.vue')
  }
  ,
  {
    path: '/index',
    name: 'index',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: function () {
      return import(/* webpackChunkName: "about" */ '../views/index.vue')
    },
    meta: { requiresAuth: true }, // 需要认证
    children: [
      {
        path: '',
        name: 'home',
        component: ()=>import('../views/home.vue')
      },
      {
        path: 'content',
        name: 'content',
        component: ()=>import('../components/teachers/content.vue')
      },
      {
        path: 'all-wwk',
        name: 'teachers',
        component: ()=>import('../components/teachers/all-teachers.vue')
      },
      {
        path: 'all-articles',
        name:'students',
        component: ()=>import('../components/teachers/all-articles.vue')
      },
      {
        path: 'deal_course',
        name: 'deal_course',
        component: ()=>import('../views/deal_course.vue')
      } ,
      // 用户管理
      {
        path: 'user-management',
        name: 'user-management',
        component: ()=>import('../components/users/user-management.vue')
      },
      // 学生端
      {
        path: 'student_course',
        name: 'student_course',
        component: ()=>import('../views/student_course.vue')
      },
      {
        path: 'student_my_course',
        name: 'student_my_course',
        component: ()=>import('../views/student_my_course.vue')
      },
      {
        path: 'question',
        name: 'question',
        component: ()=>import('../views/question.vue')
      }
    ]


  },


]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
